//51521	patriking	1036	Accepted	932 kb	16 ms	C++	1711 B	2010-11-02 15:36:20
// Tree DP.
/*
 * Description
 *
 * Farmer John has decided to give each of his cows a cell phone in
 * hopes to encourage their social interaction. This, however, requires
 * him to set up cell phone towers on his N (1 <= N <= 10,000) pastures
 * (conveniently numbered 1..N) so they can all communicate.
 *
 * Exactly N-1 pairs of pastures are adjacent, and for any two pastures
 * A and B (1 <= A <= N; 1 <= B <= N; A != B) there is a sequence of
 * adjacent pastures such that A is the first pasture in the sequence
 * and B is the last. Farmer John can only place cell phone towers in
 * the pastures, and each tower has enough range to provide service
 * to the pasture it is on and all pastures adjacent to the pasture
 * with the cell tower.
 *
 * Help him determine the minimum number of towers he must install to
 * provide cell phone service to each pasture.
 * Input
 *
 * * Line 1: A single integer: N
 *
 * * Lines 2..N: Each line specifies a pair of adjacent pastures with two
 * space-separated integers: A and B
 * Output
 *
 *
 * * Line 1: A single integer indicating the minimum number of towers to
 * install
 * Sample Input
 *
 * 5
 * 1 3
 * 5 2
 * 4 3
 * 3 5
 *
 * Sample Output
 *
 * 2
 *
 */
// Code as follow.
#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;
class cellNetwork
{
	int n;
	int *f[3];
	vector<vector<int> >list;
	inline int min(int a, int b){
		return (a<b?a:b);
	}
public:
	bool init();
	int treedp(int v,int p);
	void solve();
};
bool cellNetwork::init()
{
	if(EOF == scanf("%d",&n))
		return false;
	int x, y;
	list.clear();
	list.resize(n+1);
	for(int i = 1; i < n; i++)
	{
		scanf("%d%d",&x,&y);
		list[x].push_back(y);
		list[y].push_back(x);
	}
	return true;
}
int cellNetwork::treedp(int v,int pre)
{
	if(pre != 0 && list[v].size() == 1)
	{
		f[1][v] = 1;
		f[0][v] = 1;
		f[2][v] = 0;
		return 0;
	}
	f[0][v] = f[2][v] = 0;
	f[1][v] = 1;
	int tmp = 0;
	int ans = 10000;
	for(int i = 0; i < list[v].size(); i++)
	{
		if(list[v][i] == pre)continue;
		int next = list[v][i];
		treedp(next,v);
		f[1][v] += min(f[1][next],min(f[0][next],f[2][next]));
		f[2][v] += min(f[1][next],f[0][next]);
		f[0][v] += min(f[1][next],f[0][next]);
		if(f[1][next] <= f[0][next])
			tmp = 1;
		ans = min(ans,f[1][next] - f[0][next]);
	}
	if(tmp)return 0;
	f[0][v] += ans;
	return 0;
}
void cellNetwork::solve()
{
	for(int i = 0; i <= 2; i++)
		f[i] = new int[n+1];
	treedp(1,0);
	printf("%d\n",f[0][1] < f[1][1] ? f[0][1]:f[1][1]);
	for(int i = 0; i <= 2; i++)
		delete[] f[i];
}
int main(int argc, int **argv)
{
	cellNetwork A;
	while(A.init())
		A.solve();
	return 0;
}

